module.exports = function (controller) {
    for (const key of Object.keys(controller)) { //遍历controller
        const fn = controller[key];
        controller[key] = function (req, res, next) { //包装异步处理，并统一发送错误信息
            Promise.resolve()
                .then(() => fn(req, res, next))
                .catch(err => {
                    console.log(err);
                    next('Server Error');
                })
        }
    }
}